package br.edu.ifrn.tads.rettiwt;

import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;

public final class PMF{
	private static final PersistenceManagerFactory factory = JDOHelper.getPersistenceManagerFactory("transactions-optional"); 
    private static PersistenceManager manager = null;
    private PMF() {}

    public static PersistenceManager getManager() {
    	if (manager == null || manager.isClosed()){
    		manager = factory.getPersistenceManager();
    	}
    	return manager;
    }
}